module.exports = app => {
    const { STRING, INTEGER, DATE } = app.Sequelize;
    const PostComment = app.model.define('post_comment', {
        id: {
            type: INTEGER(20),
            primaryKey: true,
            autoIncrement: true,
            comment:"自增ID"
        },
        postId: {
            type: INTEGER(20),
            allowNull: false,
            defaultValue: 0,
            comment: '帖子id'
        },
        userId: {
            type: INTEGER(20),
            allowNull: false,
            defaultValue: 0,
            comment: '评论用户id'
        },
        content: {
            type: STRING,
            allowNull: false,
            defaultValue: '',
            comment: '评论内容'
        },
        created_time: DATE,
        updated_time: DATE,
    });
    // 关联关系
    PostComment.associate = function (models) {
        // 关联用户
        PostComment.belongsTo(app.model.User);
        // 关联帖子
        PostComment.belongsTo(app.model.Post);
    }
    return PostComment;
};